<%-- 
    Document   : register
    Created on : 2008-8-26, 19:37:22
    Author     : Ruby
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="sunsite.tools.*,java.util.*,sunsite.service.*" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <title>注册</title>
        <%  String serverPath = Path.getServerUrl(request);%>
        <link rel="stylesheet" type="text/css" href="<%=serverPath%>ExtJs/resources/css/ext-all.css" />
        <script type="text/javascript" src="<%=serverPath%>ExtJs/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="<%=serverPath%>ExtJs/ext-all.js"></script>
        <script type="text/javascript" src="<%=serverPath%>js/user.js"></script>
        <script type="text/javascript" src="<%=serverPath%>js/tools.js"></script>
    </head>
    <body>
        <script>
            function setSubmit(status)
            {
                var btn = document.getElementById('submitBtn');
                if(status == true)
                    btn.disabled='';
                else
                    btn.disabled='disabled';
            }
            function checkForm()
            {
                var array = document.getElementById('registerDiv').getElementsByTagName('input');
                if(array[1].value.length < 4 || array[2].value.length < 6 || array[3].value!=array[2].value || array[4].value<1 ||array[5].value.toString().indexOf('@')<0)
                {
                    alert('<s:text name="user.regInfoErTip"/>');
                    return false;
                }
                //var form = document.getElementById("form1").submit();
                return true;
            }
        </script>
        <s:property value="message"/><br/>
        
        

    <div id="registerDiv">
    <form id="form1" action="register.action" method="POST">
        <input type="hidden" name="type" value="submit"/>
        <table align="center" cellspacing="7px">
            <tr>
                <td width="200px" align="right" valign="top"><font size="2" ><s:text name="user.userName"/><font color="red" size="2">*</font></font></td>
                <td width="210" align="left" valign="top"><input name="userName" type="text" class="textbox" size="26" onkeyup="if(this.value.length>3){checkUser(this.value,'checkUser')}else{var t = document.getElementById('checkUser');t.color='#ff0000';t.innerHTML='用户名长度不足';}" maxlength="20">
                    <font id="checkUser" size="2"></font>
                </td>
                <td width="250" valign="top" align="left"><font size="2">
                    <s:text name="user.userNameTip"/> </font>
                </td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.password"/><font color="red" size="2">*</font></font></td>
                <td align="left"><input name="password" type="password" class="textbox" size="26" maxlength="20" onkeyup="if(this.value.length<6){var t = document.getElementById('checkPsw');t.innerHTML='密码长度不足';}else{var t = document.getElementById('checkPsw');t.innerHTML='';}">
                    <font id="checkPsw" color="#ff0000" size="2"></font>
                </td>
                <td rowspan="2"><font size="2" ><s:text name="user.passwordTip"/></font></td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.passwordAg"/><font color="red" size="2">*</font></font></td>
                <td align="left"><input name="passwordAg" type="password" onkeyup="var t = document.getElementById('checkPasswordAg');if(this.value!=document.getElementById('registerDiv').getElementsByTagName('input')[2].value){t.innerHTML='两次输入的密码不一致';}else{t.innerHTML='';}" class="textbox" size="26" maxlength="20">
                    <font id="checkPasswordAg" color="#ff0000" size="2"></font>
                </td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.fullName"/><font color="red" size="2">*</font></font></td>
                <td align="left"><input name="fullName" type="text" class="textbox" size="26" maxlength="20" onkeyup="var t = document.getElementById('checkFullName');if(this.value.length<1){t.innerHTML='请输入真实姓名';}else{t.innerHTML='';}">
                    <font id="checkFullName" color="#ff0000" size="2"></font>
                </td>
                <td width="250" valign="top" align="left"><font size="2">
                    <s:text name="user.fullNameTip"></s:text></font></td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.email"/><font color="red" size="2">*</font></font></td>
                <td align="left"><input name="email" type="text" class="textbox" size="26" maxlength="20" onkeyup="var t = document.getElementById('checkEmail');if(this.value.toString().indexOf('@')<0){t.innerHTML='邮件格式不正确';}else{t.innerHTML='';}" />
                    <font id="checkEmail" color="#ff0000" size="2"></font>
                </td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.phone"/></font></td>
                <td align="left"><input name="phone" type="text" class="textbox" size="26" maxlength="20"/></td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.university"/></font></td>
                <td align="left">
                    <s:select name="university" headerKey="-1" headerValue="请选择" list="universities" listKey="uniId" listValue="uniName"/>
                </td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.degree"/></font></td>
                <td align="left">
                    <s:select name="degree" headerKey="" headerValue="请选择" list="degrees" listKey="dicValue" listValue="dicValue"></s:select>
                </td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.major"/></font></td>
                <td align="left"><input name="major" type="text" class="textbox" size="26" maxlength="20"/></td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.grade"/></font></td>
                <td align="left">
                    <s:select name="grade" list="gradeList" headerKey="" headerValue="请选择" listKey="dicValue" listValue="dicValue"></s:select>
                </td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.sai"/></font></td>
                <td align="left">
                    <s:select name="sai" list="sais" headerKey="-1" headerValue="请选择" listKey="saiId" listValue="sainame"></s:select>
                </td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.saiCode"/></font></td>
                <td align="left"><input name="saiCode" type="text" class="textbox" size="26" maxlength="20"/></td>
            </tr>
            <tr>
                <td align="right"><font size="2" ><s:text name="user.userGroup"/></font></td>
                <td align="left"><s:checkbox name="userGroup" /></td>
            </tr>
            <tr>
                <td align="right" valign="center"><font size="2" ><s:text name="message.verifyCode"/></font></td>
                <td align="left" valign="center">
                    <table cellpadding="0px" cellspacing="0px">
                        <tr>
                            <td width="80px" valign="center"><input name="verifyCode" type="text" class="textbox" maxlength="6" size="6"></td>
                            <td valign="center"><img id="verifyCodeImageRegister" src='<%=Path.getServerUrl(request)%>tools/verifyCode.jsp?width=80&heigth=24'/></td>
                        </tr>
                    </table>
                <td valign="center" align="left"><a href="#" onclick='return getVerifyCode("verifyCodeImageRegister","<%=Path.getServerUrl(request)%>");'><font size="2" > <s:text name="message.refreshCode"/></font></a></td>
            </tr>
            <tr>
                <td align="center" colspan="3">
                    <input name="agreement" onmousedown="if(this.checked!='')setSubmit(false);else setSubmit(true);" type="checkbox"/><font size="2"><s:text name="user.readDoc"/>《<a target="_blank" href="document/agreement.html"><s:text name="user.agreementDoc"/></a>》</font>
                </td>
            </tr>
            <tr>
                <td colspan="3" align="center"><input type="submit" disabled onclick="return checkForm();" id="submitBtn" value="<s:text name="user.registerBtn"></s:text>"/></td>
            </tr>
        </table>
    </form>
    </div>
    
    </body>
</html>
